import $ from "jquery";
import {url} from "../../util/config";
import {closeStatus, openStatus} from "../../store/action";
import {error as exception, success} from "../../util/responseStatus";

export default function deleteFile(path) {
    //item為數組，元素的值是：userId_roleId
    console.log(path)
    let token = localStorage.getItem("token")
    let status = null
    $.ajax({
        async:false,
        headers: {
            'Accept': "application/json",
            'Authorization': token
        },
        url: url.api_url+`FileList/DeleteFile`,
        type: 'POST',
        contentType:"application/json",
        data: JSON.stringify({
            url:path
        }),
        success: function (result) {
            status = result.result;
            if(status=="ok"){
                success();
            }else {
                exception()
            }
        },
        error:function (error) {
            alert("网络不通")
        }
    })
    return status;

//  写ajax时把上面注释取消
//     return 'ok';
}

